<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('四向车监控')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row col-sm-12">
            <div id="div2" style="height: 20%;width: 98.5%" class="col-sm-5 select-table">
                <h3>堆垛机</h3>
                <table id="bootstrap-table2"></table>
            </div>
            <div id="div1" style="height: 75%;width: 50%;top :1%" class="row col-sm-12">
                <div id="div11" style="height: 50%;width: 100%" class="col-sm-5 select-table"><h3>入库巷道口</h3>
                    <table id="bootstrap-table1"></table>
                </div>
                <div id="div12" style="height:50%;width: 100%" class="col-sm-5 select-table"><h3>入库口</h3>
                    <table id="bootstrap-table5"></table>
                </div>
            </div>
            <div id="div3" style="height: 75%;width: 50%;top: 1%;left: 1%" class="row col-sm-12">
                <div id="div13" style="height: 50%;width: 100%;left: 2%" class="col-sm-5 select-table"><h3>
                    出库巷道口</h3>
                    <table id="bootstrap-table3"></table>
                </div>
                <div id="div14" style="height:50%;width: 100%;left: 2%" class="col-sm-5 select-table"><h3>出库口</h3>
                    <table id="bootstrap-table6"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:manage:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:manage:remove')}]];
    var prefix = ctx + "system/manage";
    $(function () {
        var panehHidden = false;
        if ($(this).width() < 769) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 85});
        // 回到顶部绑定
        if ($.fn.toTop !== undefined) {
            var opt = {
                win: $('.ui-layout-center'),
                doc: $('.ui-layout-center')
            };
            $('#scroll-up').toTop(opt);
        }

        queryUserList1();
        queryUserList2();
        queryUserList3();
        // queryUserList4();
        queryUserList5();
        queryUserList6();

        reloadTable();


    });

    function reloadTable() {

        $('#bootstrap-table1').bootstrapTable('refresh');
        $('#bootstrap-table2').bootstrapTable('refresh');
        $('#bootstrap-table3').bootstrapTable('refresh');
        $('#bootstrap-table4').bootstrapTable('refresh');
        $('#bootstrap-table5').bootstrapTable('refresh');
        $('#bootstrap-table6').bootstrapTable('refresh');

        setTimeout(reloadTable, 3 * 1000);
    }


    function queryUserList1() {

        var options1 = {
            url: "/system/bzk/list?location=3",
            height: $("#div11").height() / 1.1,
            modalName: "id",
            columns: [

                {
                    field: 'id',
                    title: '设备编号 ',
                    class: 'text-center'
                },

                {
                    field: 'name',
                    title: '设备名称 ',
                    class: 'text-center'
                },
                {
                    field: 'rwh',
                    title: '任务号 ',
                    class: 'text-center'
                },
                {
                    field: 'dw',
                    title: '到位信号',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "入库到位";
                        } else if (value == 2) {
                            return "出库到位";
                        } else {
                            return "未到位";
                        }
                    },
                    class: 'text-center'
                },
                {
                    field: 'kx',
                    title: '空闲信号 ',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "空闲";
                        } else {
                            return "未空闲";
                        }
                    },
                    class: 'text-center'
                },

                {
                    field: 'tmfk',
                    title: '托盘条码',
                    sortable: true,
                    class: 'text-center'

                }
            ]
        };
        $('#bootstrap-table1').bootstrapTable(options1)
    }

    function queryUserList5() {

        var options5 = {
            url: "/system/bzk/list?location=1",
            height: $("#div12").height() / 1.1,
            modalName: "id",
            columns: [

                {
                    field: 'id',
                    title: '设备编号 ',
                    class: 'text-center'
                },

                {
                    field: 'name',
                    title: '设备名称 ',
                    class: 'text-center'
                },
                {
                    field: 'rwh',
                    title: '任务号 ',
                    class: 'text-center'
                },
                {
                    field: 'dw',
                    title: '到位信号',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "入库到位";
                        } else if (value == 2) {
                            return "出库到位";
                        } else {
                            return "未到位";
                        }
                    },
                    class: 'text-center'
                },
                {
                    field: 'kx',
                    title: '空闲信号 ',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "空闲";
                        } else {
                            return "未空闲";
                        }
                    },
                    class: 'text-center'
                },

                {
                    field: 'tmfk',
                    title: '托盘条码',
                    sortable: true,
                    class: 'text-center'

                }
            ]
        };
        $('#bootstrap-table5').bootstrapTable(options5)
    }

    function queryUserList2() {

        var options2 = {
            url: "/deviceInfo/ddj/list1",
            editUrl: prefix + "/edit",
            height: $("#div2").height() / 1.1,
            modalName: "sxc",
            columns: [

                {
                    field: 'id',
                    title: '设备编号',

                    class: 'text-center'
                },
                {
                    field: 'name',
                    title: '设备名称 ',
                    class: 'text-center'
                },
                {
                    field: 'rwh',
                    title: '任务号',
                    sortable: true,
                    class: 'text-center'
                },
                {
                    field: 'czfs',
                    title: '操作方式',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "未知";
                        } else if (value == 1) {
                            return "手动";
                        } else if (value == 2) {
                            return "自动";
                        }
                    },
                    class: 'text-center'
                },
                {
                    field: 'yxzt',
                    title: '运行状态',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "未知";
                        } else if (value == 1) {
                            return "无货待机";
                        } else if (value == 2) {
                            return "运行";
                        } else {
                            return "错误";
                        }
                    },
                    class: 'text-center'
                },
                // {
                //     field: 'ydz',
                //     title: '源站点',
                //     sortable: true
                // },
                // {
                //     field: 'mbdz',
                //     title: '目标地址',
                //     sortable: true
                // },
                {
                    field: 'jdbz',
                    title: '阶段标志',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 0) {
                            return "未开始";
                        } else if (value == 1) {
                            return "取货途中";
                        } else if (value == 2) {
                            return "取货";
                        } else if (value == 3) {
                            return "放货途中";
                        } else if (value == 4) {
                            return "放货";
                        } else if (value == 5) {
                            return "完成";
                        }
                    },
                    class: 'text-center'
                },
                {
                    field: 'sbzt',
                    title: '异常状态',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 101) {
                            return "急停按下";
                        } else if (value == 102) {
                            return "输送变频报警";
                        } else if (value == 103) {
                            return "运行变频报警";
                        } else if (value == 106) {
                            return "BPS出错";
                        } else if (value == 107) {
                            return "输送超时";
                        } else if (value == 108) {
                            return "设定超限";
                        } else if (value == 153) {
                            return "运行启动需确认";
                        } else if (value == 154) {
                            return "放货完成有货";
                        } else if (value == 155) {
                            return "取货途中检测到小车有货";
                        } else if (value == 156) {
                            return "放货途中检测到无货";
                        } else if (value == 157) {
                            return "待机有货";
                        } else if (value == 158) {
                            return "地面SS1柜子急停";
                        } else if (value == 159) {
                            return "通讯故障";
                        } else if (value == 160) {
                            return "前进限位";
                        } else if (value == 161) {
                            return "后退限位";
                        } else if (value == 162) {
                            return "输送机超出";
                        } else if (value == 163) {
                            return "请求停止穿梭车";
                        } else if (value == 164) {
                            return "小车与输送机RWH不一致";
                        } else if (value == 165) {
                            return "前防撞触发";
                        } else if (value == 166) {
                            return "后防撞触发";
                        } else {
                            return "正常";
                        }
                    },
                    class: 'text-center'
                },

                {
                    field: 'yxxf',
                    title: '允许下发',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "不允许";
                        } else if (value == 0) {
                            return "允许";
                        }
                    },
                    class: 'text-center'
                }
            ]
        };
        $('#bootstrap-table2').bootstrapTable(options2)
    }

    function queryUserList3() {

        var options3 = {
            url: "/system/bzk/list?location=4",
            editUrl: prefix + "/edit",
            height: $("#div14").height() / 1.1,
            modalName: "sxc",
            columns: [

                {
                    field: 'id',
                    title: '设备编号 ',
                    class: 'text-center',
                },

                {
                    field: 'name',
                    title: '设备名称 ',
                    class: 'text-center'
                },
                {
                    field: 'rwh',
                    title: '任务号 ',
                    class: 'text-center'
                },
                {
                    field: 'dw',
                    title: '到位信号',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "入库到位";
                        } else if (value == 2) {
                            return "出库到位";
                        } else {
                            return "未到位";
                        }
                    },
                    class: 'text-center'
                },
                {
                    field: 'kx',
                    title: '空闲信号 ',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "空闲";
                        } else {
                            return "未空闲";
                        }
                    },
                    class: 'text-center'
                },

                {
                    field: 'tmfk',
                    title: '托盘条码',
                    sortable: true,
                    class: 'text-center'
                }
            ]
        };
        $('#bootstrap-table3').bootstrapTable(options3)
    }

    function queryUserList4() {

        var options4 = {
            url: "/msgLxkSsj/lxk/list?location=4",
            height: $("#div4").height() * 0.95,
            modalName: "id",
            columns: [

                {
                    field: 'id',
                    title: '设备编号 '
                },
                // {
                //     field: 'location',
                //     title: '',
                //     sortable: true
                // },
                {
                    field: 'name',
                    title: '设备名称 '
                },
                {
                    field: 'rwh',
                    title: '任务号 '
                },
                {
                    field: 'dw',
                    title: '到位信号',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "入库到位";
                        } else if (value == 2) {
                            return "出库到位";
                        } else {
                            return "未到位";
                        }
                    }
                },
                {
                    field: 'kx',
                    title: '空闲信号 ',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "空闲";
                        } else {
                            return "未空闲";
                        }
                    }
                },

                {
                    field: 'tmfk',
                    title: '托盘条码',
                    sortable: true,

                }
            ]
        };
        $('#bootstrap-table4').bootstrapTable(options4)
    }

    function queryUserList6() {

        var options6 = {
            url: "/system/bzk/list?location=5",
            height: $("#div14").height() / 1.1,
            modalName: "id",
            columns: [

                {
                    field: 'id',
                    title: '设备编号 ',
                    class: 'text-center'
                },
                // {
                //     field: 'location',
                //     title: '',
                //     sortable: true
                // },
                {
                    field: 'name',
                    title: '设备名称 ',
                    class: 'text-center'
                },
                {
                    field: 'rwh',
                    title: '任务号 ',
                    class: 'text-center'
                },
                {
                    field: 'dw',
                    title: '到位信号',
                    class: 'text-center',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "入库到位";
                        } else if (value == 2) {
                            return "出库到位";
                        } else {
                            return "未到位";
                        }
                    }
                },
                {
                    field: 'kx',
                    title: '空闲信号 ',
                    class: 'text-center',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "空闲";
                        } else {
                            return "未空闲";
                        }
                    }
                },

                {
                    field: 'tmfk',
                    title: '托盘条码',
                    class: 'text-center',
                    sortable: true,


                }
            ]
        };
        $('#bootstrap-table6').bootstrapTable(options6)
    }
</script>
</body>
</html>